package com.hj.lib.util;

import java.net.InetAddress;
import java.net.NetworkInterface;

public class DevUtil {

	public static String getMACAddress(){
		StringBuffer sb = new StringBuffer();
		try {
			InetAddress ia = InetAddress.getLocalHost();
			byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();
			for (int i = 0; i < mac.length; i++) {
				if (i != 0) {
					sb.append("-");
				}
				String s = Integer.toHexString(mac[i] & 0xFF);
				sb.append(s.length() == 1 ? 0 + s : s);
			}

		} catch (Exception e) {

		}

		return sb.toString().toUpperCase();
	}

}
